package kizzo.game 
{
	import flash.display.Sprite;
	import flash.events.Event;
	import flash.events.MouseEvent;
	import flash.text.TextField;
	import org.flashdevelop.utils.FlashConnect;
	/**
	 * ...
	 * @author KiZZo
	 */
	public class BrushMenuButton extends Sprite
	{
		private var menu:BrushMenu;	
		private var brush_type:uint;
		
		public function BrushMenuButton(button_label:String, menu:BrushMenu, brush_type:uint) 
		{
			this.menu = menu;
			this.brush_type = brush_type;
			
			this.graphics.beginFill(0x88cc88, .6);
			this.graphics.drawRect(0, 0, 100, 30);
			this.graphics.endFill();
			
			var tf:TextField = new TextField();
			tf.selectable = false;
			tf.text = button_label;
			tf.y = 6; 
			tf.x = 4;
			this.addChild(tf);
			
			this.addEventListener(MouseEvent.CLICK, click_handler);
		}
		
		private function click_handler(e:Event):void
		{			
			menu.selected_brush = this.brush_type;
		}
		
	}

}